/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.logiclander.whozwho.data.dao.hibernate;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NaturalId;


/**
 *
 * @author logiclander
 */
@Entity
@Table(name = "APPLICATIONS")
public class Application implements Serializable {

  private long sid;
  private String name;
  private boolean activeIndicator;
  private System system;
  private Set<Capability> capabilities;

  @Id
  @GeneratedValue(generator = "increment")
  @GenericGenerator(name = "increment", strategy = "increment")
  @Column(name = "application_sid", nullable = false)
  public Long getSid() {
    return sid;
  }

  public void setSid(long sid) {
    this.sid = sid;
  }

  @NaturalId
  @Column(name = "application_name", nullable = false)
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  @Column(name = "active_indicator", nullable = false)
  public boolean getActiveIndicator() {
    return activeIndicator;
  }

  public void setActiveIndicator(boolean activeIndicator) {
    this.activeIndicator = activeIndicator;
  }

//  @ManyToOne
//  @JoinColumn(name="system_sid")
  public System getSystem() {
    return system;
  }
  
  public void setSystem(System system) {
	  this.system = system;
  }

//capabilities
  @ManyToMany
  @JoinColumn(name="capability_sid")
  public Set<Capability> getCapabilities() {
    return capabilities;
  }
  
  public void setCapabilities(Set<Capability> capabilities) {
	  this.capabilities = capabilities;
  }
  
}
